set more off
capture log close
cd *** Fill in path name here ***

//  program:    AnanatEtAl_income-college attenance gradient results
//  task:		Regressions of income-colleage attendance gradient on job loss ages 12-17, including state-specific linear trends

log using *** Fill in file name here ***, replace text

**** ALL CHILDREN ****; 
// #1
// Load data
use AnanatEtAl_income_college_data.dta, clear

// #2
// Generate state-specific linear time trends
qui for var stated*: gen Xtrend=X*year

// #3 
// Run IV regressions of income-college gradient on job losses
// Weighted by total number of children and by total black population

ivreg2 collegeage19slope stated* yeard* (JL_lagged1217sep = JL_lagged1217tic) [fw=numberofchildren], cluster (stateno) first

ivreg2 collegeage19slope stated* yeard* (JL_lagged1217sep = JL_lagged1217tic) [fw=tot_black], cluster (stateno) first

clear

log close
